<!-- HTML header for doxygen 1.8.8-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <!-- For Mobile Devices -->
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
        <meta name="generator" content="Doxygen 1.8.18"/>
        <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
        <title>HElib: helib::AddDAG Class Reference</title>
        <!--<link href="tabs.css" rel="stylesheet" type="text/css"/>-->
        <script type="text/javascript" src="dynsections.js"></script>
        <link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
        <link href="doxygen.css" rel="stylesheet" type="text/css" />
        <link href="customdoxygen.css" rel="stylesheet" type="text/css"/>
        <link href='https://fonts.googleapis.com/css?family=Roboto+Slab' rel='stylesheet' type='text/css'>
		<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,100;1,700&family=Merriweather&family=Merriweather+Sans&family=Open+Sans&family=Poppins:ital@1&family=Roboto:ital,wght@0,400;1,300;1,900&display=swap" rel="stylesheet"> 
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
        <link href="jquery.smartmenus.bootstrap.css" rel="stylesheet">
        <script type="text/javascript" src="jquery.smartmenus.js"></script>
        <!-- SmartMenus jQuery Bootstrap Addon -->
        <script type="text/javascript" src="jquery.smartmenus.bootstrap.js"></script>
        <!-- SmartMenus jQuery plugin -->
    </head>
    <body style="font-family: 'Merriweather', serif;">
        <nav class="navbar navbar-default" role="navigation">
            <div class="container">
                <div class="navbar-header">
                    <a class="navbar-brand">HElib Implementing Homomorphic Encryption</a>
                </div>
            </div>
        </nav>
        <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
            <div class="content" id="content">
                <div class="container">
                    <div class="row">
                        <div class="col-sm-12 panel " style="padding-bottom: 15px;">
                            <div style="margin-bottom: 15px;">
<!-- end header part -->
<!-- Generated by Doxygen 1.8.18 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespacehelib.html">helib</a></li><li class="navelem"><a class="el" href="classhelib_1_1_add_d_a_g.html">AddDAG</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classhelib_1_1_add_d_a_g-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">helib::AddDAG Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>A class representing the logic of the order of bit products when adding two integers.  
 <a href="classhelib_1_1_add_d_a_g.html#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:ae2d6170c036b65028e05a980f494d3ea"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classhelib_1_1_add_d_a_g.html#ae2d6170c036b65028e05a980f494d3ea">init</a> (const <a class="el" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a> &amp;a, const <a class="el" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a> &amp;b)</td></tr>
<tr class="memdesc:ae2d6170c036b65028e05a980f494d3ea"><td class="mdescLeft">&#160;</td><td class="mdescRight">Build a plan to add a and b.  <a href="classhelib_1_1_add_d_a_g.html#ae2d6170c036b65028e05a980f494d3ea">More...</a><br /></td></tr>
<tr class="separator:ae2d6170c036b65028e05a980f494d3ea"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa2876101e413ca38cb16296db1ab5b55"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classhelib_1_1_add_d_a_g.html#aa2876101e413ca38cb16296db1ab5b55">AddDAG</a> (const <a class="el" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a> &amp;a, const <a class="el" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a> &amp;b)</td></tr>
<tr class="separator:aa2876101e413ca38cb16296db1ab5b55"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab87ceaab4404df21f12c7a112dd30e49"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classhelib_1_1_add_d_a_g.html#ab87ceaab4404df21f12c7a112dd30e49">apply</a> (<a class="el" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a> &amp;sum, const <a class="el" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a> &amp;a, const <a class="el" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a> &amp;b, long sizeLimit=0)</td></tr>
<tr class="memdesc:ab87ceaab4404df21f12c7a112dd30e49"><td class="mdescLeft">&#160;</td><td class="mdescRight">Perform the actual addition.  <a href="classhelib_1_1_add_d_a_g.html#ab87ceaab4404df21f12c7a112dd30e49">More...</a><br /></td></tr>
<tr class="separator:ab87ceaab4404df21f12c7a112dd30e49"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af432678f8a0b3b81ac0ab34f38b28c96"><td class="memItemLeft" align="right" valign="top">long&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classhelib_1_1_add_d_a_g.html#af432678f8a0b3b81ac0ab34f38b28c96">lowLvl</a> () const</td></tr>
<tr class="memdesc:af432678f8a0b3b81ac0ab34f38b28c96"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the lowest level in this DAG.  <a href="classhelib_1_1_add_d_a_g.html#af432678f8a0b3b81ac0ab34f38b28c96">More...</a><br /></td></tr>
<tr class="separator:af432678f8a0b3b81ac0ab34f38b28c96"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a35ca142cc56f34e19c38e6a118e6dab9"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classhelib_1_1_d_a_gnode.html">DAGnode</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classhelib_1_1_add_d_a_g.html#a35ca142cc56f34e19c38e6a118e6dab9">findP</a> (long i, long j) const</td></tr>
<tr class="memdesc:a35ca142cc56f34e19c38e6a118e6dab9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns a pointer to the a 'p' node of index (i,j)  <a href="classhelib_1_1_add_d_a_g.html#a35ca142cc56f34e19c38e6a118e6dab9">More...</a><br /></td></tr>
<tr class="separator:a35ca142cc56f34e19c38e6a118e6dab9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac93d4ffdc12fa10bb0222a1e2a95de7e"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classhelib_1_1_d_a_gnode.html">DAGnode</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classhelib_1_1_add_d_a_g.html#ac93d4ffdc12fa10bb0222a1e2a95de7e">findQ</a> (long i, long j) const</td></tr>
<tr class="memdesc:ac93d4ffdc12fa10bb0222a1e2a95de7e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns a pointer to the a 'q' node of index (i,j)  <a href="classhelib_1_1_add_d_a_g.html#ac93d4ffdc12fa10bb0222a1e2a95de7e">More...</a><br /></td></tr>
<tr class="separator:ac93d4ffdc12fa10bb0222a1e2a95de7e"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>A class representing the logic of the order of bit products when adding two integers. </p>
<p>Given two input arrays a[], b[], we build a DAG with each node representing a term either of the form p_{i,j} = \prod_{t=j}^i (a[t]+b[t]), or of the form q_{i,j} = (a[j]*b[j]) * \prod_{t=j+1}^i (a[t]+b[t]). The source nodes are of the forms (a[i]*b[i]) and (a[i]+b[i]), and each non-source node has exactly two parents, whose product yields that node.</p>
<p>When building the DAG, we keep the level of each node as high as possible. For example we can set q_{i,j}=p_{i,k}*q_{k-1,j} or q_{i,j}=p_{i,k+1}*q_{k,j} (among other options), and we choose the option that results in the highest level. In addition, we try to minimize the number of nodes in the DAG that actually need to be computed while adding the two numbers (subject to still consuming as few levels as possible). </p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="aa2876101e413ca38cb16296db1ab5b55"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa2876101e413ca38cb16296db1ab5b55">&#9670;&nbsp;</a></span>AddDAG()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">helib::AddDAG::AddDAG </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a> &amp;&#160;</td>
          <td class="paramname"><em>a</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a> &amp;&#160;</td>
          <td class="paramname"><em>b</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="ab87ceaab4404df21f12c7a112dd30e49"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab87ceaab4404df21f12c7a112dd30e49">&#9670;&nbsp;</a></span>apply()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void helib::AddDAG::apply </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a> &amp;&#160;</td>
          <td class="paramname"><em>sum</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a> &amp;&#160;</td>
          <td class="paramname"><em>a</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a> &amp;&#160;</td>
          <td class="paramname"><em>b</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">long&#160;</td>
          <td class="paramname"><em>sizeLimit</em> = <code>0</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Perform the actual addition. </p>
<p>Apply the DAG to actually compute the sum. </p>

</div>
</div>
<a id="a35ca142cc56f34e19c38e6a118e6dab9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a35ca142cc56f34e19c38e6a118e6dab9">&#9670;&nbsp;</a></span>findP()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classhelib_1_1_d_a_gnode.html">DAGnode</a>* helib::AddDAG::findP </td>
          <td>(</td>
          <td class="paramtype">long&#160;</td>
          <td class="paramname"><em>i</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">long&#160;</td>
          <td class="paramname"><em>j</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Returns a pointer to the a 'p' node of index (i,j) </p>

</div>
</div>
<a id="ac93d4ffdc12fa10bb0222a1e2a95de7e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac93d4ffdc12fa10bb0222a1e2a95de7e">&#9670;&nbsp;</a></span>findQ()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classhelib_1_1_d_a_gnode.html">DAGnode</a>* helib::AddDAG::findQ </td>
          <td>(</td>
          <td class="paramtype">long&#160;</td>
          <td class="paramname"><em>i</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">long&#160;</td>
          <td class="paramname"><em>j</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Returns a pointer to the a 'q' node of index (i,j) </p>

</div>
</div>
<a id="ae2d6170c036b65028e05a980f494d3ea"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae2d6170c036b65028e05a980f494d3ea">&#9670;&nbsp;</a></span>init()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void helib::AddDAG::init </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a> &amp;&#160;</td>
          <td class="paramname"><em>a</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="namespacehelib.html#afac4e5ae4b272f9ffd07daee26285dad">CtPtrs</a> &amp;&#160;</td>
          <td class="paramname"><em>b</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Build a plan to add a and b. </p>

</div>
</div>
<a id="af432678f8a0b3b81ac0ab34f38b28c96"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af432678f8a0b3b81ac0ab34f38b28c96">&#9670;&nbsp;</a></span>lowLvl()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">long helib::AddDAG::lowLvl </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Returns the lowest level in this DAG. </p>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>/HElib/src/<a class="el" href="binary_arith_8cpp.html">binaryArith.cpp</a></li>
</ul>
</div><!-- contents -->
<!-- HTML footer for doxygen 1.8.8-->
<!-- start footer part -->
</div>
</div>
</div>
</div>
</div>
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.18
</small></address>
</body>
        <script type="text/javascript" src="doxy-boot.js"></script>
</html>
